# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

class ApiAdmin(models.Model):
    id = models.IntegerField(primary_key=True)
    admin_id = models.CharField(max_length=20, blank=True, null=True)
    admin_pwd = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_admin'


class ApiAuthor(models.Model):
    author = models.CharField(max_length=255)
    book_id = models.IntegerField(blank=True, null=True)
    book_name = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_author'


class ApiBlack(models.Model):
    user_id = models.IntegerField()
    user_name = models.CharField(max_length=255)
    reason = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_black'


class ApiBook(models.Model):
    book_name = models.CharField(max_length=255, blank=True, null=True)
    book_type = models.CharField(max_length=32, blank=True, null=True)
    author = models.CharField(max_length=255, blank=True, null=True)
    translator = models.CharField(max_length=255, blank=True, null=True)
    publisher = models.CharField(max_length=255, blank=True, null=True)
    publish_time = models.DateTimeField(blank=True, null=True)
    price = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True)
    storage = models.IntegerField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_book'


class ApiBorrow(models.Model):
    book_id = models.IntegerField()
    user_id = models.CharField(max_length=20)
    book_name = models.CharField(max_length=255, blank=True, null=True)
    user_name = models.CharField(max_length=255, blank=True, null=True)
    borrow_date = models.DateTimeField(blank=True, null=True)
    back_date = models.DateTimeField(blank=True, null=True)
    if_back = models.IntegerField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_borrow'


class ApiPublisher(models.Model):
    pubisher = models.CharField(max_length=255)
    book_id = models.IntegerField(blank=True, null=True)
    book_name = models.CharField(max_length=255, blank=True, null=True)
    address = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_publisher'


class ApiUser(models.Model):
    user_id = models.CharField(max_length=20)
    user_name = models.CharField(max_length=255)
    user_type = models.CharField(max_length=255, blank=True, null=True)
    credit = models.IntegerField(blank=True, null=True)
    max_num = models.IntegerField(blank=True, null=True)
    max_days = models.IntegerField(blank=True, null=True)
    sex = models.CharField(max_length=255, blank=True, null=True)
    pwd = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'api_user'
